<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>京东商品价格信息</title>
		<script src="js/jquery.min.js"></script>
	</head>
	<body>
		<div>
			商品编号：<span id="id"></span>
		</div>
		<div>
			商品价格：<span id="price"></span>
		</div>
	</body>
	<script>
		//1.实线写死的字符串，解析展现到页面上
		// var jsonstr='[{"p":"99.00","op":"329.00","cbf":"0","id":"J_64234584219","m":"599.00"}]'
		// var obj=JSON.parse(jsonstr);
		
		//发起AJAX请求
		$.ajax({
			type: "get",
			url: "https://p.3.cn/prices/mgets?skuIds=J_100010378153",
			dataType: "jsonp",
			success:function(data){
				console.log(data);
				
				var price=data[0].p;
				var id=data[0].id;
				console.log(price); 
				console.log(id);

				$("#id").text(id).css("color","#AA3333");
				$("#price").text("¥"+price).css("color","#336688");
			}
		});
		
		
	</script>
	
</html>
